<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.12.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>NeuZephyr: D:/Users/Mgepahmge/Documents/C Program/NeuZephyr/include/NeuZephyr/ComputeGraph.cuh Source File</title>
<link rel="icon" href="NZ_logo2.png" type="image/x-icon" />
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectlogo"><img alt="Logo" src="NZ_logo2.png"/></td>
  <td id="projectalign">
   <div id="projectname">NeuZephyr
   </div>
   <div id="projectbrief">Simple DL Framework</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.12.0 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() { codefold.init(0); });
/* @license-end */
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function(){ initResizable(false); });
/* @license-end */
</script>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d522931ffa1371640980b621734a4381.html">Users</a></li><li class="navelem"><a class="el" href="dir_a7e6ee1ae3f772c9504a0b543f2027e2.html">Mgepahmge</a></li><li class="navelem"><a class="el" href="dir_e03f57e346cc4845a4c354a35630b169.html">Documents</a></li><li class="navelem"><a class="el" href="dir_231a0482af2b83c895f27ba7fe745141.html">C Program</a></li><li class="navelem"><a class="el" href="dir_0fa7fc3a0dfd304dbfc9dce9f6facfa2.html">NeuZephyr</a></li><li class="navelem"><a class="el" href="dir_e7295b03dab2e9cdf32139bd8ec2e607.html">include</a></li><li class="navelem"><a class="el" href="dir_657344ecc65cfc28732701509f8d8421.html">NeuZephyr</a></li>  </ul>
</div>
</div><!-- top -->
<div id="doc-content">
<div class="header">
  <div class="headertitle"><div class="title">ComputeGraph.cuh</div></div>
</div><!--header-->
<div class="contents">
<a href="_compute_graph_8cuh.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno">    1</span> </div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno">   58</span><span class="preprocessor">#ifndef COMPUTEGRAPH_CUH</span></div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno">   59</span><span class="preprocessor">#define COMPUTEGRAPH_CUH</span></div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno">   60</span> </div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno">   61</span><span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno">   62</span><span class="preprocessor">#include &lt;queue&gt;</span></div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno">   63</span><span class="preprocessor">#include &quot;<a class="code" href="_operation_kernels_8cuh.html">OperationKernels.cuh</a>&quot;</span></div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno">   64</span><span class="preprocessor">#include &quot;<a class="code" href="_optimizer_8cuh.html">Optimizer.cuh</a>&quot;</span></div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno">   65</span><span class="preprocessor">#include &quot;utils.cuh&quot;</span></div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno">   66</span> </div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno">   95</span><span class="keyword">namespace </span><a class="code hl_namespace" href="namespacenz_1_1graph.html">nz::graph</a> {</div>
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno">   96</span>    <span class="keyword">using namespace </span>nodes;</div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno">   97</span>    <span class="keyword">using namespace </span>data;</div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno">   98</span>    <span class="keyword">using namespace </span>krnl;</div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno">   99</span>    <span class="keyword">using namespace </span>opt;</div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno">  100</span>    <span class="keyword">using namespace </span>nodes::io;</div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno">  101</span>    <span class="keyword">using namespace </span>nodes::calc;</div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno">  102</span>    <span class="keyword">using namespace </span>nodes::loss;</div>
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno">  103</span> </div>
<div class="foldopen" id="foldopen00224" data-start="{" data-end="};">
<div class="line"><a id="l00224" name="l00224"></a><span class="lineno"><a class="line" href="classnz_1_1graph_1_1_compute_graph.html">  224</a></span>    <span class="keyword">class </span>DL_API <a class="code hl_class" href="classnz_1_1graph_1_1_compute_graph.html">ComputeGraph</a> {</div>
<div class="line"><a id="l00225" name="l00225"></a><span class="lineno">  225</span>        std::vector&lt;Node*&gt; nodes;</div>
<div class="line"><a id="l00226" name="l00226"></a><span class="lineno">  226</span>        std::vector&lt;Node*&gt; inputNodes;</div>
<div class="line"><a id="l00227" name="l00227"></a><span class="lineno">  227</span>        std::vector&lt;OutputNode*&gt; outputNodes;</div>
<div class="line"><a id="l00228" name="l00228"></a><span class="lineno">  228</span>        std::vector&lt;Node*&gt; sortedNodes;</div>
<div class="line"><a id="l00229" name="l00229"></a><span class="lineno">  229</span> </div>
<div class="line"><a id="l00230" name="l00230"></a><span class="lineno">  230</span>        std::unordered_map&lt;Node*, int&gt; inDegree;</div>
<div class="line"><a id="l00231" name="l00231"></a><span class="lineno">  231</span>        std::unordered_map&lt;Node*, std::vector&lt;Node*&gt;&gt; adjList;</div>
<div class="line"><a id="l00232" name="l00232"></a><span class="lineno">  232</span>        std::unordered_map&lt;std::string, Node*&gt; nodeRoster;</div>
<div class="line"><a id="l00233" name="l00233"></a><span class="lineno">  233</span>        std::unordered_map&lt;Node*, std::string&gt; nodeRosterReverse;</div>
<div class="line"><a id="l00234" name="l00234"></a><span class="lineno">  234</span>        <span class="keywordtype">int</span> nodesRef = 0;</div>
<div class="line"><a id="l00235" name="l00235"></a><span class="lineno">  235</span> </div>
<div class="line"><a id="l00236" name="l00236"></a><span class="lineno">  236</span>    <span class="keyword">public</span>:</div>
<div class="line"><a id="l00237" name="l00237"></a><span class="lineno">  237</span>        <span class="keyword">friend</span> DL_API std::ostream&amp; <a class="code hl_function" href="namespacenz_1_1nodes.html#a42672c2d7708ae1d0c071fd9bef6c03c">operator&lt;&lt;</a>(std::ostream&amp; os, <a class="code hl_class" href="classnz_1_1graph_1_1_compute_graph.html">ComputeGraph</a>&amp; graph);</div>
<div class="line"><a id="l00238" name="l00238"></a><span class="lineno">  238</span>        <span class="keyword">friend</span> DL_API <span class="keywordtype">void</span> <a class="code hl_function" href="namespacenz_1_1graph.html#a3c6187d695022b05df227d913ac89d91">CreateNode</a>(<a class="code hl_class" href="classnz_1_1graph_1_1_compute_graph.html">ComputeGraph</a>* graph, <span class="keyword">const</span> std::string&amp; type, <span class="keyword">const</span> std::string&amp; name,</div>
<div class="line"><a id="l00239" name="l00239"></a><span class="lineno">  239</span>                                      std::vector&lt;int&gt; pre,</div>
<div class="line"><a id="l00240" name="l00240"></a><span class="lineno">  240</span>                                      <span class="keyword">const</span> <a class="code hl_class" href="classnz_1_1data_1_1_dimension.html">Tensor::shape_type</a>&amp; shape, <span class="keywordtype">float</span>* data, <span class="keywordtype">bool</span> requires_grad,</div>
<div class="line"><a id="l00241" name="l00241"></a><span class="lineno">  241</span>                                      <span class="keywordtype">float</span>* grad);</div>
<div class="line"><a id="l00242" name="l00242"></a><span class="lineno">  242</span> </div>
<div class="line"><a id="l00245" name="l00245"></a><span class="lineno">  245</span> </div>
<div class="line"><a id="l00267" name="l00267"></a><span class="lineno"><a class="line" href="classnz_1_1graph_1_1_compute_graph.html#a328a263c572540a330ba650651fb7722">  267</a></span>        <a class="code hl_function" href="classnz_1_1graph_1_1_compute_graph.html#a328a263c572540a330ba650651fb7722">ComputeGraph</a>() = <span class="keywordflow">default</span>;</div>
<div class="line"><a id="l00268" name="l00268"></a><span class="lineno">  268</span> </div>
<div class="line"><a id="l00288" name="l00288"></a><span class="lineno"><a class="line" href="classnz_1_1graph_1_1_compute_graph.html#a6397db45a249af6389dd3f7548b5aa0a">  288</a></span>        <a class="code hl_function" href="classnz_1_1graph_1_1_compute_graph.html#a6397db45a249af6389dd3f7548b5aa0a">~ComputeGraph</a>() = <span class="keywordflow">default</span>;</div>
<div class="line"><a id="l00289" name="l00289"></a><span class="lineno">  289</span> </div>
<div class="line"><a id="l00291" name="l00291"></a><span class="lineno">  291</span> </div>
<div class="line"><a id="l00294" name="l00294"></a><span class="lineno">  294</span> </div>
<div class="line"><a id="l00325" name="l00325"></a><span class="lineno">  325</span>        <a class="code hl_class" href="classnz_1_1nodes_1_1io_1_1_input_node.html">InputNode</a>* addInput(<span class="keyword">const</span> <a class="code hl_class" href="classnz_1_1data_1_1_dimension.html">Tensor::shape_type</a>&amp; shape, <span class="keywordtype">bool</span> requires_grad = <span class="keyword">false</span>,</div>
<div class="line"><a id="l00326" name="l00326"></a><span class="lineno">  326</span>                            <span class="keyword">const</span> std::string&amp; name = <span class="stringliteral">&quot;default&quot;</span>);</div>
<div class="line"><a id="l00327" name="l00327"></a><span class="lineno">  327</span> </div>
<div class="line"><a id="l00360" name="l00360"></a><span class="lineno">  360</span>        <a class="code hl_class" href="classnz_1_1nodes_1_1io_1_1_input_node.html">InputNode</a>* addInput(<span class="keyword">const</span> <a class="code hl_class" href="classnz_1_1data_1_1_tensor.html">Tensor</a>&amp; tensor, <span class="keyword">const</span> std::string&amp; name = <span class="stringliteral">&quot;default&quot;</span>);</div>
<div class="line"><a id="l00361" name="l00361"></a><span class="lineno">  361</span> </div>
<div class="line"><a id="l00392" name="l00392"></a><span class="lineno">  392</span>        <a class="code hl_class" href="classnz_1_1nodes_1_1io_1_1_input_node.html">InputNode</a>* addInput(<a class="code hl_class" href="classnz_1_1nodes_1_1io_1_1_input_node.html">InputNode</a>* input, <span class="keyword">const</span> std::string&amp; name = <span class="stringliteral">&quot;default&quot;</span>);</div>
<div class="line"><a id="l00393" name="l00393"></a><span class="lineno">  393</span> </div>
<div class="line"><a id="l00432" name="l00432"></a><span class="lineno">  432</span>        <a class="code hl_class" href="classnz_1_1nodes_1_1io_1_1_input_node.html">InputNode</a>* addInput(<span class="keyword">const</span> <a class="code hl_class" href="classnz_1_1data_1_1_dimension.html">Tensor::shape_type</a>&amp; shape, Tensor::value_type* data, <span class="keywordtype">bool</span> requires_grad,</div>
<div class="line"><a id="l00433" name="l00433"></a><span class="lineno">  433</span>                            <span class="keywordtype">bool</span> host, <span class="keyword">const</span> std::string&amp; name = <span class="stringliteral">&quot;default&quot;</span>);</div>
<div class="line"><a id="l00434" name="l00434"></a><span class="lineno">  434</span> </div>
<div class="line"><a id="l00471" name="l00471"></a><span class="lineno">  471</span>        <a class="code hl_class" href="classnz_1_1nodes_1_1io_1_1_input_node.html">InputNode</a>* addInput(<span class="keyword">const</span> <a class="code hl_class" href="classnz_1_1data_1_1_dimension.html">Tensor::shape_type</a>&amp; shape, <span class="keyword">const</span> std::initializer_list&lt;Tensor::value_type&gt;&amp; data,</div>
<div class="line"><a id="l00472" name="l00472"></a><span class="lineno">  472</span>                            <span class="keywordtype">bool</span> requires_grad, <span class="keyword">const</span> std::string&amp; name = <span class="stringliteral">&quot;default&quot;</span>);</div>
<div class="line"><a id="l00473" name="l00473"></a><span class="lineno">  473</span> </div>
<div class="line"><a id="l00510" name="l00510"></a><span class="lineno">  510</span>        <span class="keyword">template</span> &lt;<span class="keyword">typename</span> NodeType&gt;</div>
<div class="foldopen" id="foldopen00511" data-start="{" data-end="}">
<div class="line"><a id="l00511" name="l00511"></a><span class="lineno"><a class="line" href="classnz_1_1graph_1_1_compute_graph.html#a5ce9a271dcea6cc2b9490cd815ee53ed">  511</a></span>        NodeType* <a class="code hl_function" href="classnz_1_1graph_1_1_compute_graph.html#a5ce9a271dcea6cc2b9490cd815ee53ed">addNode</a>(NodeType* node, <span class="keyword">const</span> std::string&amp; name = <span class="stringliteral">&quot;default&quot;</span>) {</div>
<div class="line"><a id="l00512" name="l00512"></a><span class="lineno">  512</span>            nodes.push_back(node);</div>
<div class="line"><a id="l00513" name="l00513"></a><span class="lineno">  513</span>            <span class="keywordflow">if</span> (name == <span class="stringliteral">&quot;default&quot;</span>) {</div>
<div class="line"><a id="l00514" name="l00514"></a><span class="lineno">  514</span>                <span class="keyword">const</span> std::string node_name = node-&gt;type + <span class="stringliteral">&quot;_&quot;</span> + std::to_string(nodesRef);</div>
<div class="line"><a id="l00515" name="l00515"></a><span class="lineno">  515</span>                nodeRoster[node_name] = node;</div>
<div class="line"><a id="l00516" name="l00516"></a><span class="lineno">  516</span>                nodeRosterReverse[node] = node_name;</div>
<div class="line"><a id="l00517" name="l00517"></a><span class="lineno">  517</span>                nodesRef++;</div>
<div class="line"><a id="l00518" name="l00518"></a><span class="lineno">  518</span>            }</div>
<div class="line"><a id="l00519" name="l00519"></a><span class="lineno">  519</span>            <span class="keywordflow">else</span> {</div>
<div class="line"><a id="l00520" name="l00520"></a><span class="lineno">  520</span>                nodeRoster[name] = node;</div>
<div class="line"><a id="l00521" name="l00521"></a><span class="lineno">  521</span>                nodeRosterReverse[node] = name;</div>
<div class="line"><a id="l00522" name="l00522"></a><span class="lineno">  522</span>            }</div>
<div class="line"><a id="l00523" name="l00523"></a><span class="lineno">  523</span>            <span class="keywordflow">return</span> node;</div>
<div class="line"><a id="l00524" name="l00524"></a><span class="lineno">  524</span>        }</div>
</div>
<div class="line"><a id="l00525" name="l00525"></a><span class="lineno">  525</span> </div>
<div class="line"><a id="l00570" name="l00570"></a><span class="lineno">  570</span>        <span class="keyword">template</span> &lt;<span class="keyword">typename</span>... Args&gt;</div>
<div class="foldopen" id="foldopen00571" data-start="{" data-end="}">
<div class="line"><a id="l00571" name="l00571"></a><span class="lineno"><a class="line" href="classnz_1_1graph_1_1_compute_graph.html#a21a839e5d155c752db1f2130812bc787">  571</a></span>        <a class="code hl_class" href="classnz_1_1nodes_1_1_node.html">Node</a>* <a class="code hl_function" href="classnz_1_1graph_1_1_compute_graph.html#a21a839e5d155c752db1f2130812bc787">addNode</a>(<span class="keyword">const</span> std::string&amp; type, <span class="keyword">const</span> std::string&amp; input1, <span class="keyword">const</span> std::string&amp; input2,</div>
<div class="line"><a id="l00572" name="l00572"></a><span class="lineno">  572</span>                      <span class="keyword">const</span> std::string&amp; name = <span class="stringliteral">&quot;default&quot;</span>, Args... args) {</div>
<div class="line"><a id="l00573" name="l00573"></a><span class="lineno">  573</span>            <span class="keywordflow">if</span> (type == <span class="stringliteral">&quot;Input&quot;</span>) {</div>
<div class="line"><a id="l00574" name="l00574"></a><span class="lineno">  574</span>                WARN(<span class="stringliteral">&quot;Input node cannot be added by addNode(...)&quot;</span>);</div>
<div class="line"><a id="l00575" name="l00575"></a><span class="lineno">  575</span>                <span class="keywordflow">return</span> <span class="keyword">nullptr</span>;</div>
<div class="line"><a id="l00576" name="l00576"></a><span class="lineno">  576</span>            }</div>
<div class="line"><a id="l00577" name="l00577"></a><span class="lineno">  577</span>            <span class="keywordflow">if</span> (type == <span class="stringliteral">&quot;Output&quot;</span>) {</div>
<div class="line"><a id="l00578" name="l00578"></a><span class="lineno">  578</span>                <span class="keywordflow">if</span> (nodeRoster.find(input1) == nodeRoster.end()) {</div>
<div class="line"><a id="l00579" name="l00579"></a><span class="lineno">  579</span>                    <span class="keywordflow">throw</span> std::runtime_error(<span class="stringliteral">&quot;Input node not found&quot;</span>);</div>
<div class="line"><a id="l00580" name="l00580"></a><span class="lineno">  580</span>                }</div>
<div class="line"><a id="l00581" name="l00581"></a><span class="lineno">  581</span>                <span class="keywordflow">return</span> addOutput(<span class="keyword">new</span> <a class="code hl_class" href="classnz_1_1nodes_1_1io_1_1_output_node.html">OutputNode</a>(nodeRoster[input1]), name);</div>
<div class="line"><a id="l00582" name="l00582"></a><span class="lineno">  582</span>            }</div>
<div class="line"><a id="l00583" name="l00583"></a><span class="lineno">  583</span>            <span class="keywordflow">if</span> (type == <span class="stringliteral">&quot;Add&quot;</span>) {</div>
<div class="line"><a id="l00584" name="l00584"></a><span class="lineno">  584</span>                <span class="keywordflow">if</span> (nodeRoster.find(input1) == nodeRoster.end() || nodeRoster.find(input2) == nodeRoster.end()) {</div>
<div class="line"><a id="l00585" name="l00585"></a><span class="lineno">  585</span>                    <span class="keywordflow">throw</span> std::runtime_error(<span class="stringliteral">&quot;Input node not found&quot;</span>);</div>
<div class="line"><a id="l00586" name="l00586"></a><span class="lineno">  586</span>                }</div>
<div class="line"><a id="l00587" name="l00587"></a><span class="lineno">  587</span>                <span class="keywordflow">return</span> addNode(<span class="keyword">new</span> <a class="code hl_class" href="classnz_1_1nodes_1_1calc_1_1_add_node.html">AddNode</a>(nodeRoster[input1], nodeRoster[input2]), name);</div>
<div class="line"><a id="l00588" name="l00588"></a><span class="lineno">  588</span>            }</div>
<div class="line"><a id="l00589" name="l00589"></a><span class="lineno">  589</span>            <span class="keywordflow">if</span> (type == <span class="stringliteral">&quot;MatMul&quot;</span>) {</div>
<div class="line"><a id="l00590" name="l00590"></a><span class="lineno">  590</span>                <span class="keywordflow">if</span> (nodeRoster.find(input1) == nodeRoster.end() || nodeRoster.find(input2) == nodeRoster.end()) {</div>
<div class="line"><a id="l00591" name="l00591"></a><span class="lineno">  591</span>                    <span class="keywordflow">throw</span> std::runtime_error(<span class="stringliteral">&quot;Input node not found&quot;</span>);</div>
<div class="line"><a id="l00592" name="l00592"></a><span class="lineno">  592</span>                }</div>
<div class="line"><a id="l00593" name="l00593"></a><span class="lineno">  593</span>                <span class="keywordflow">return</span> addNode(<span class="keyword">new</span> <a class="code hl_class" href="classnz_1_1nodes_1_1calc_1_1_mat_mul_node.html">MatMulNode</a>(nodeRoster[input1], nodeRoster[input2]), name);</div>
<div class="line"><a id="l00594" name="l00594"></a><span class="lineno">  594</span>            }</div>
<div class="line"><a id="l00595" name="l00595"></a><span class="lineno">  595</span>            <span class="keywordflow">if</span> (type == <span class="stringliteral">&quot;Sub&quot;</span>) {</div>
<div class="line"><a id="l00596" name="l00596"></a><span class="lineno">  596</span>                <span class="keywordflow">if</span> (nodeRoster.find(input1) == nodeRoster.end() || nodeRoster.find(input2) == nodeRoster.end()) {</div>
<div class="line"><a id="l00597" name="l00597"></a><span class="lineno">  597</span>                    <span class="keywordflow">throw</span> std::runtime_error(<span class="stringliteral">&quot;Input node not found&quot;</span>);</div>
<div class="line"><a id="l00598" name="l00598"></a><span class="lineno">  598</span>                }</div>
<div class="line"><a id="l00599" name="l00599"></a><span class="lineno">  599</span>                <span class="keywordflow">return</span> addNode(<span class="keyword">new</span> <a class="code hl_class" href="classnz_1_1nodes_1_1calc_1_1_sub_node.html">SubNode</a>(nodeRoster[input1], nodeRoster[input2]), name);</div>
<div class="line"><a id="l00600" name="l00600"></a><span class="lineno">  600</span>            }</div>
<div class="line"><a id="l00601" name="l00601"></a><span class="lineno">  601</span>            <span class="keywordflow">if</span> (type == <span class="stringliteral">&quot;ReLU&quot;</span>) {</div>
<div class="line"><a id="l00602" name="l00602"></a><span class="lineno">  602</span>                <span class="keywordflow">if</span> (nodeRoster.find(input1) == nodeRoster.end()) {</div>
<div class="line"><a id="l00603" name="l00603"></a><span class="lineno">  603</span>                    <span class="keywordflow">throw</span> std::runtime_error(<span class="stringliteral">&quot;Input node not found&quot;</span>);</div>
<div class="line"><a id="l00604" name="l00604"></a><span class="lineno">  604</span>                }</div>
<div class="line"><a id="l00605" name="l00605"></a><span class="lineno">  605</span>                <span class="keywordflow">return</span> addNode(<span class="keyword">new</span> <a class="code hl_class" href="classnz_1_1nodes_1_1calc_1_1_re_l_u_node.html">ReLUNode</a>(nodeRoster[input1]), name);</div>
<div class="line"><a id="l00606" name="l00606"></a><span class="lineno">  606</span>            }</div>
<div class="line"><a id="l00607" name="l00607"></a><span class="lineno">  607</span>            <span class="keywordflow">if</span> (type == <span class="stringliteral">&quot;Sigmoid&quot;</span>) {</div>
<div class="line"><a id="l00608" name="l00608"></a><span class="lineno">  608</span>                <span class="keywordflow">if</span> (nodeRoster.find(input1) == nodeRoster.end()) {</div>
<div class="line"><a id="l00609" name="l00609"></a><span class="lineno">  609</span>                    <span class="keywordflow">throw</span> std::runtime_error(<span class="stringliteral">&quot;Input node not found&quot;</span>);</div>
<div class="line"><a id="l00610" name="l00610"></a><span class="lineno">  610</span>                }</div>
<div class="line"><a id="l00611" name="l00611"></a><span class="lineno">  611</span>                <span class="keywordflow">return</span> addNode(<span class="keyword">new</span> <a class="code hl_class" href="classnz_1_1nodes_1_1calc_1_1_sigmoid_node.html">SigmoidNode</a>(nodeRoster[input1]), name);</div>
<div class="line"><a id="l00612" name="l00612"></a><span class="lineno">  612</span>            }</div>
<div class="line"><a id="l00613" name="l00613"></a><span class="lineno">  613</span>            <span class="keywordflow">if</span> (type == <span class="stringliteral">&quot;Tanh&quot;</span>) {</div>
<div class="line"><a id="l00614" name="l00614"></a><span class="lineno">  614</span>                <span class="keywordflow">if</span> (nodeRoster.find(input1) == nodeRoster.end()) {</div>
<div class="line"><a id="l00615" name="l00615"></a><span class="lineno">  615</span>                    <span class="keywordflow">throw</span> std::runtime_error(<span class="stringliteral">&quot;Input node not found&quot;</span>);</div>
<div class="line"><a id="l00616" name="l00616"></a><span class="lineno">  616</span>                }</div>
<div class="line"><a id="l00617" name="l00617"></a><span class="lineno">  617</span>                <span class="keywordflow">return</span> addNode(<span class="keyword">new</span> <a class="code hl_class" href="classnz_1_1nodes_1_1calc_1_1_tanh_node.html">TanhNode</a>(nodeRoster[input1]), name);</div>
<div class="line"><a id="l00618" name="l00618"></a><span class="lineno">  618</span>            }</div>
<div class="line"><a id="l00619" name="l00619"></a><span class="lineno">  619</span>            <span class="keywordflow">if</span> (type == <span class="stringliteral">&quot;LeakyReLU&quot;</span>) {</div>
<div class="line"><a id="l00620" name="l00620"></a><span class="lineno">  620</span>                <span class="keywordflow">if</span> (nodeRoster.find(input1) == nodeRoster.end()) {</div>
<div class="line"><a id="l00621" name="l00621"></a><span class="lineno">  621</span>                    <span class="keywordflow">throw</span> std::runtime_error(<span class="stringliteral">&quot;Input node not found&quot;</span>);</div>
<div class="line"><a id="l00622" name="l00622"></a><span class="lineno">  622</span>                }</div>
<div class="line"><a id="l00623" name="l00623"></a><span class="lineno">  623</span>                <span class="keywordflow">return</span> addNode(<span class="keyword">new</span> <a class="code hl_class" href="classnz_1_1nodes_1_1calc_1_1_leaky_re_l_u_node.html">LeakyReLUNode</a>(nodeRoster[input1], args...), name);</div>
<div class="line"><a id="l00624" name="l00624"></a><span class="lineno">  624</span>            }</div>
<div class="line"><a id="l00625" name="l00625"></a><span class="lineno">  625</span>            <span class="keywordflow">if</span> (type == <span class="stringliteral">&quot;Swish&quot;</span>) {</div>
<div class="line"><a id="l00626" name="l00626"></a><span class="lineno">  626</span>                <span class="keywordflow">if</span> (nodeRoster.find(input1) == nodeRoster.end()) {</div>
<div class="line"><a id="l00627" name="l00627"></a><span class="lineno">  627</span>                    <span class="keywordflow">throw</span> std::runtime_error(<span class="stringliteral">&quot;Input node not found&quot;</span>);</div>
<div class="line"><a id="l00628" name="l00628"></a><span class="lineno">  628</span>                }</div>
<div class="line"><a id="l00629" name="l00629"></a><span class="lineno">  629</span>                <span class="keywordflow">return</span> addNode(<span class="keyword">new</span> <a class="code hl_class" href="classnz_1_1nodes_1_1calc_1_1_swish_node.html">SwishNode</a>(nodeRoster[input1]), name);</div>
<div class="line"><a id="l00630" name="l00630"></a><span class="lineno">  630</span>            }</div>
<div class="line"><a id="l00631" name="l00631"></a><span class="lineno">  631</span>            <span class="keywordflow">if</span> (type == <span class="stringliteral">&quot;ELU&quot;</span>) {</div>
<div class="line"><a id="l00632" name="l00632"></a><span class="lineno">  632</span>                <span class="keywordflow">if</span> (nodeRoster.find(input1) == nodeRoster.end()) {</div>
<div class="line"><a id="l00633" name="l00633"></a><span class="lineno">  633</span>                    <span class="keywordflow">throw</span> std::runtime_error(<span class="stringliteral">&quot;Input node not found&quot;</span>);</div>
<div class="line"><a id="l00634" name="l00634"></a><span class="lineno">  634</span>                }</div>
<div class="line"><a id="l00635" name="l00635"></a><span class="lineno">  635</span>                <span class="keywordflow">return</span> addNode(<span class="keyword">new</span> <a class="code hl_class" href="classnz_1_1nodes_1_1calc_1_1_e_l_u_node.html">ELUNode</a>(nodeRoster[input1], args...), name);</div>
<div class="line"><a id="l00636" name="l00636"></a><span class="lineno">  636</span>            }</div>
<div class="line"><a id="l00637" name="l00637"></a><span class="lineno">  637</span>            <span class="keywordflow">if</span> (type == <span class="stringliteral">&quot;HardSigmoid&quot;</span>) {</div>
<div class="line"><a id="l00638" name="l00638"></a><span class="lineno">  638</span>                <span class="keywordflow">if</span> (nodeRoster.find(input1) == nodeRoster.end()) {</div>
<div class="line"><a id="l00639" name="l00639"></a><span class="lineno">  639</span>                    <span class="keywordflow">throw</span> std::runtime_error(<span class="stringliteral">&quot;Input node not found&quot;</span>);</div>
<div class="line"><a id="l00640" name="l00640"></a><span class="lineno">  640</span>                }</div>
<div class="line"><a id="l00641" name="l00641"></a><span class="lineno">  641</span>                <span class="keywordflow">return</span> addNode(<span class="keyword">new</span> <a class="code hl_class" href="classnz_1_1nodes_1_1calc_1_1_hard_sigmoid_node.html">HardSigmoidNode</a>(nodeRoster[input1], args...), name);</div>
<div class="line"><a id="l00642" name="l00642"></a><span class="lineno">  642</span>            }</div>
<div class="line"><a id="l00643" name="l00643"></a><span class="lineno">  643</span>            <span class="keywordflow">if</span> (type == <span class="stringliteral">&quot;HardSwish&quot;</span>) {</div>
<div class="line"><a id="l00644" name="l00644"></a><span class="lineno">  644</span>                <span class="keywordflow">if</span> (nodeRoster.find(input1) == nodeRoster.end()) {</div>
<div class="line"><a id="l00645" name="l00645"></a><span class="lineno">  645</span>                    <span class="keywordflow">throw</span> std::runtime_error(<span class="stringliteral">&quot;Input node not found&quot;</span>);</div>
<div class="line"><a id="l00646" name="l00646"></a><span class="lineno">  646</span>                }</div>
<div class="line"><a id="l00647" name="l00647"></a><span class="lineno">  647</span>                <span class="keywordflow">return</span> addNode(<span class="keyword">new</span> <a class="code hl_class" href="classnz_1_1nodes_1_1calc_1_1_hard_swish_node.html">HardSwishNode</a>(nodeRoster[input1], args...), name);</div>
<div class="line"><a id="l00648" name="l00648"></a><span class="lineno">  648</span>            }</div>
<div class="line"><a id="l00649" name="l00649"></a><span class="lineno">  649</span>            <span class="keywordflow">if</span> (type == <span class="stringliteral">&quot;Softmax&quot;</span>) {</div>
<div class="line"><a id="l00650" name="l00650"></a><span class="lineno">  650</span>                <span class="keywordflow">if</span> (nodeRoster.find(input1) == nodeRoster.end()) {</div>
<div class="line"><a id="l00651" name="l00651"></a><span class="lineno">  651</span>                    <span class="keywordflow">throw</span> std::runtime_error(<span class="stringliteral">&quot;Input node not found&quot;</span>);</div>
<div class="line"><a id="l00652" name="l00652"></a><span class="lineno">  652</span>                }</div>
<div class="line"><a id="l00653" name="l00653"></a><span class="lineno">  653</span>                <span class="keywordflow">return</span> addNode(<span class="keyword">new</span> <a class="code hl_class" href="classnz_1_1nodes_1_1calc_1_1_softmax_node.html">SoftmaxNode</a>(nodeRoster[input1]), name);</div>
<div class="line"><a id="l00654" name="l00654"></a><span class="lineno">  654</span>            }</div>
<div class="line"><a id="l00655" name="l00655"></a><span class="lineno">  655</span>            <span class="keywordflow">if</span> (type == <span class="stringliteral">&quot;MeanSquaredError&quot;</span>) {</div>
<div class="line"><a id="l00656" name="l00656"></a><span class="lineno">  656</span>                <span class="keywordflow">if</span> (nodeRoster.find(input1) == nodeRoster.end() || nodeRoster.find(input2) == nodeRoster.end()) {</div>
<div class="line"><a id="l00657" name="l00657"></a><span class="lineno">  657</span>                    <span class="keywordflow">throw</span> std::runtime_error(<span class="stringliteral">&quot;Input node not found&quot;</span>);</div>
<div class="line"><a id="l00658" name="l00658"></a><span class="lineno">  658</span>                }</div>
<div class="line"><a id="l00659" name="l00659"></a><span class="lineno">  659</span>                <span class="keywordflow">return</span> addOutput(<span class="keyword">new</span> <a class="code hl_class" href="classnz_1_1nodes_1_1loss_1_1_mean_squared_error_node.html">MeanSquaredErrorNode</a>(nodeRoster[input1], nodeRoster[input2]), name);</div>
<div class="line"><a id="l00660" name="l00660"></a><span class="lineno">  660</span>            }</div>
<div class="line"><a id="l00661" name="l00661"></a><span class="lineno">  661</span>            <span class="keywordflow">if</span> (type == <span class="stringliteral">&quot;BinaryCrossEntropy&quot;</span>) {</div>
<div class="line"><a id="l00662" name="l00662"></a><span class="lineno">  662</span>                <span class="keywordflow">if</span> (nodeRoster.find(input1) == nodeRoster.end() || nodeRoster.find(input2) == nodeRoster.end()) {</div>
<div class="line"><a id="l00663" name="l00663"></a><span class="lineno">  663</span>                    <span class="keywordflow">throw</span> std::runtime_error(<span class="stringliteral">&quot;Input node not found&quot;</span>);</div>
<div class="line"><a id="l00664" name="l00664"></a><span class="lineno">  664</span>                }</div>
<div class="line"><a id="l00665" name="l00665"></a><span class="lineno">  665</span>                <span class="keywordflow">return</span> addOutput(<span class="keyword">new</span> <a class="code hl_class" href="classnz_1_1nodes_1_1loss_1_1_binary_cross_entropy_node.html">BinaryCrossEntropyNode</a>(nodeRoster[input1], nodeRoster[input2]), name);</div>
<div class="line"><a id="l00666" name="l00666"></a><span class="lineno">  666</span>            }</div>
<div class="line"><a id="l00667" name="l00667"></a><span class="lineno">  667</span>            <span class="keywordflow">if</span> (type == <span class="stringliteral">&quot;ScalarAdd&quot;</span> || type == <span class="stringliteral">&quot;ScalarSub&quot;</span> || type == <span class="stringliteral">&quot;ScalarMul&quot;</span> || type == <span class="stringliteral">&quot;ScalarDiv&quot;</span>) {</div>
<div class="line"><a id="l00668" name="l00668"></a><span class="lineno">  668</span>                WARN(<span class="stringliteral">&quot;Scalar nodes cannot be added by addNode(...)&quot;</span>);</div>
<div class="line"><a id="l00669" name="l00669"></a><span class="lineno">  669</span>                <span class="keywordflow">return</span> <span class="keyword">nullptr</span>;</div>
<div class="line"><a id="l00670" name="l00670"></a><span class="lineno">  670</span>            }</div>
<div class="line"><a id="l00671" name="l00671"></a><span class="lineno">  671</span>            <span class="keywordflow">throw</span> std::runtime_error(<span class="stringliteral">&quot;Node type not found&quot;</span>);</div>
<div class="line"><a id="l00672" name="l00672"></a><span class="lineno">  672</span>        }</div>
</div>
<div class="line"><a id="l00673" name="l00673"></a><span class="lineno">  673</span> </div>
<div class="line"><a id="l00713" name="l00713"></a><span class="lineno">  713</span>        <a class="code hl_class" href="classnz_1_1nodes_1_1io_1_1_output_node.html">OutputNode</a>* addOutput(<a class="code hl_class" href="classnz_1_1nodes_1_1io_1_1_output_node.html">OutputNode</a>* node, <span class="keyword">const</span> std::string&amp; name = <span class="stringliteral">&quot;default&quot;</span>);</div>
<div class="line"><a id="l00714" name="l00714"></a><span class="lineno">  714</span> </div>
<div class="line"><a id="l00716" name="l00716"></a><span class="lineno">  716</span> </div>
<div class="line"><a id="l00719" name="l00719"></a><span class="lineno">  719</span> </div>
<div class="line"><a id="l00766" name="l00766"></a><span class="lineno">  766</span>        <span class="keywordtype">void</span> topologicalSort();</div>
<div class="line"><a id="l00767" name="l00767"></a><span class="lineno">  767</span> </div>
<div class="line"><a id="l00799" name="l00799"></a><span class="lineno">  799</span>        <span class="keywordtype">void</span> zeroGrad() <span class="keyword">const</span>;</div>
<div class="line"><a id="l00800" name="l00800"></a><span class="lineno">  800</span> </div>
<div class="line"><a id="l00834" name="l00834"></a><span class="lineno">  834</span>        <span class="keywordtype">void</span> randomize(<span class="keyword">const</span> std::string&amp; name, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span> seed = 0);</div>
<div class="line"><a id="l00835" name="l00835"></a><span class="lineno">  835</span> </div>
<div class="line"><a id="l00869" name="l00869"></a><span class="lineno">  869</span>        <span class="keywordtype">void</span> randomize(<span class="keyword">const</span> <a class="code hl_class" href="classnz_1_1nodes_1_1_node.html">Node</a>* node, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span> seed = 0);</div>
<div class="line"><a id="l00870" name="l00870"></a><span class="lineno">  870</span> </div>
<div class="line"><a id="l00898" name="l00898"></a><span class="lineno">  898</span>        <span class="keywordtype">void</span> randomizeAll() <span class="keyword">const</span>;</div>
<div class="line"><a id="l00899" name="l00899"></a><span class="lineno">  899</span> </div>
<div class="line"><a id="l00927" name="l00927"></a><span class="lineno">  927</span>        <span class="keywordtype">void</span> fill(<span class="keyword">const</span> std::string&amp; name, Tensor::value_type val);</div>
<div class="line"><a id="l00928" name="l00928"></a><span class="lineno">  928</span> </div>
<div class="line"><a id="l00957" name="l00957"></a><span class="lineno">  957</span>        <span class="keywordtype">void</span> fill(<span class="keyword">const</span> <a class="code hl_class" href="classnz_1_1nodes_1_1_node.html">Node</a>* node, Tensor::value_type val);</div>
<div class="line"><a id="l00958" name="l00958"></a><span class="lineno">  958</span> </div>
<div class="line"><a id="l00983" name="l00983"></a><span class="lineno">  983</span>        <span class="keywordtype">void</span> fillAll(Tensor::value_type val) <span class="keyword">const</span>;</div>
<div class="line"><a id="l00984" name="l00984"></a><span class="lineno">  984</span> </div>
<div class="line"><a id="l01014" name="l01014"></a><span class="lineno"> 1014</span>        <span class="keywordtype">void</span> setInput(<span class="keyword">const</span> std::string&amp; name, Tensor::value_type* data);</div>
<div class="line"><a id="l01015" name="l01015"></a><span class="lineno"> 1015</span> </div>
<div class="line"><a id="l01045" name="l01045"></a><span class="lineno"> 1045</span>        <span class="keywordtype">void</span> setInput(<span class="keyword">const</span> <a class="code hl_class" href="classnz_1_1nodes_1_1_node.html">Node</a>* node, Tensor::value_type* data);</div>
<div class="line"><a id="l01046" name="l01046"></a><span class="lineno"> 1046</span> </div>
<div class="line"><a id="l01048" name="l01048"></a><span class="lineno"> 1048</span> </div>
<div class="line"><a id="l01051" name="l01051"></a><span class="lineno"> 1051</span> </div>
<div class="line"><a id="l01083" name="l01083"></a><span class="lineno"> 1083</span>        [[nodiscard]] <span class="keywordtype">bool</span> isSorted() <span class="keyword">const</span>;</div>
<div class="line"><a id="l01084" name="l01084"></a><span class="lineno"> 1084</span> </div>
<div class="line"><a id="l01120" name="l01120"></a><span class="lineno"> 1120</span>        [[nodiscard]] Tensor::value_type* getOutput() <span class="keyword">const</span>;</div>
<div class="line"><a id="l01121" name="l01121"></a><span class="lineno"> 1121</span> </div>
<div class="line"><a id="l01162" name="l01162"></a><span class="lineno"> 1162</span>        [[nodiscard]] Tensor::value_type* getOutputHost() <span class="keyword">const</span>;</div>
<div class="line"><a id="l01163" name="l01163"></a><span class="lineno"> 1163</span> </div>
<div class="line"><a id="l01194" name="l01194"></a><span class="lineno"> 1194</span>        [[nodiscard]] <a class="code hl_class" href="classnz_1_1nodes_1_1io_1_1_output_node.html">OutputNode</a>* getOutputNode() <span class="keyword">const</span>;</div>
<div class="line"><a id="l01195" name="l01195"></a><span class="lineno"> 1195</span> </div>
<div class="line"><a id="l01228" name="l01228"></a><span class="lineno"> 1228</span>        [[nodiscard]] Tensor::value_type getLoss() <span class="keyword">const</span>;</div>
<div class="line"><a id="l01229" name="l01229"></a><span class="lineno"> 1229</span> </div>
<div class="line"><a id="l01262" name="l01262"></a><span class="lineno"> 1262</span>        std::ostream&amp; print(std::ostream&amp; os);</div>
<div class="line"><a id="l01263" name="l01263"></a><span class="lineno"> 1263</span> </div>
<div class="line"><a id="l01303" name="l01303"></a><span class="lineno"> 1303</span>        <a class="code hl_class" href="classnz_1_1nodes_1_1_node.html">Node</a>* operator[](<span class="keyword">const</span> std::string&amp; name);</div>
<div class="line"><a id="l01304" name="l01304"></a><span class="lineno"> 1304</span> </div>
<div class="line"><a id="l01333" name="l01333"></a><span class="lineno"> 1333</span>        std::string nodesList();</div>
<div class="line"><a id="l01334" name="l01334"></a><span class="lineno"> 1334</span> </div>
<div class="line"><a id="l01336" name="l01336"></a><span class="lineno"> 1336</span> </div>
<div class="line"><a id="l01339" name="l01339"></a><span class="lineno"> 1339</span> </div>
<div class="line"><a id="l01375" name="l01375"></a><span class="lineno"> 1375</span>        <span class="keywordtype">void</span> forward();</div>
<div class="line"><a id="l01376" name="l01376"></a><span class="lineno"> 1376</span> </div>
<div class="line"><a id="l01423" name="l01423"></a><span class="lineno"> 1423</span>        <span class="keywordtype">void</span> backward();</div>
<div class="line"><a id="l01424" name="l01424"></a><span class="lineno"> 1424</span> </div>
<div class="line"><a id="l01454" name="l01454"></a><span class="lineno"> 1454</span>        <span class="keywordtype">void</span> update(<a class="code hl_class" href="classnz_1_1opt_1_1_optimizer.html">Optimizer</a>* optimizer) <span class="keyword">const</span>;</div>
<div class="line"><a id="l01455" name="l01455"></a><span class="lineno"> 1455</span> </div>
<div class="line"><a id="l01456" name="l01456"></a><span class="lineno"> 1456</span>        <span class="keywordtype">bool</span> inGraph(<a class="code hl_class" href="classnz_1_1nodes_1_1_node.html">Node</a>* node) <span class="keyword">const</span>;</div>
<div class="line"><a id="l01457" name="l01457"></a><span class="lineno"> 1457</span> </div>
<div class="line"><a id="l01459" name="l01459"></a><span class="lineno"> 1459</span> </div>
<div class="line"><a id="l01462" name="l01462"></a><span class="lineno"> 1462</span> </div>
<div class="line"><a id="l01498" name="l01498"></a><span class="lineno"> 1498</span>        <span class="keywordtype">void</span> save(<span class="keyword">const</span> std::string&amp; path);</div>
<div class="line"><a id="l01499" name="l01499"></a><span class="lineno"> 1499</span> </div>
<div class="line"><a id="l01534" name="l01534"></a><span class="lineno"> 1534</span>        <span class="keywordtype">void</span> load(<span class="keyword">const</span> std::string&amp; path);</div>
<div class="line"><a id="l01535" name="l01535"></a><span class="lineno"> 1535</span> </div>
<div class="line"><a id="l01537" name="l01537"></a><span class="lineno"> 1537</span>    };</div>
</div>
<div class="line"><a id="l01538" name="l01538"></a><span class="lineno"> 1538</span>}</div>
<div class="line"><a id="l01539" name="l01539"></a><span class="lineno"> 1539</span> </div>
<div class="line"><a id="l01540" name="l01540"></a><span class="lineno"> 1540</span><span class="preprocessor">#endif </span><span class="comment">//COMPUTEGRAPH_CUH</span></div>
<div class="ttc" id="a_operation_kernels_8cuh_html"><div class="ttname"><a href="_operation_kernels_8cuh.html">OperationKernels.cuh</a></div><div class="ttdoc">CUDA Kernel Definitions for High-Performance Tensor Operations.</div></div>
<div class="ttc" id="a_optimizer_8cuh_html"><div class="ttname"><a href="_optimizer_8cuh.html">Optimizer.cuh</a></div><div class="ttdoc">Definition of optimization algorithms for training deep learning models.</div></div>
<div class="ttc" id="aclassnz_1_1data_1_1_dimension_html"><div class="ttname"><a href="classnz_1_1data_1_1_dimension.html">nz::data::Dimension</a></div><div class="ttdoc">Represents a multi - dimensional shape, typically used in deep learning for tensor dimensions.</div><div class="ttdef"><b>Definition</b> <a href="_dimension_8cuh_source.html#l00057">Dimension.cuh:57</a></div></div>
<div class="ttc" id="aclassnz_1_1data_1_1_tensor_html"><div class="ttname"><a href="classnz_1_1data_1_1_tensor.html">nz::data::Tensor</a></div><div class="ttdoc">A class for representing and manipulating multidimensional arrays (tensors) in GPU memory.</div><div class="ttdef"><b>Definition</b> <a href="_tensor_8cuh_source.html#l00134">Tensor.cuh:134</a></div></div>
<div class="ttc" id="aclassnz_1_1graph_1_1_compute_graph_html"><div class="ttname"><a href="classnz_1_1graph_1_1_compute_graph.html">nz::graph::ComputeGraph</a></div><div class="ttdoc">Represents a computational graph, which manages nodes and the computation flow.</div><div class="ttdef"><b>Definition</b> <a href="#l00224">ComputeGraph.cuh:224</a></div></div>
<div class="ttc" id="aclassnz_1_1graph_1_1_compute_graph_html_a21a839e5d155c752db1f2130812bc787"><div class="ttname"><a href="classnz_1_1graph_1_1_compute_graph.html#a21a839e5d155c752db1f2130812bc787">nz::graph::ComputeGraph::addNode</a></div><div class="ttdeci">Node * addNode(const std::string &amp;type, const std::string &amp;input1, const std::string &amp;input2, const std::string &amp;name=&quot;default&quot;, Args... args)</div><div class="ttdoc">Adds a node to the computational graph based on the provided node type and inputs.</div><div class="ttdef"><b>Definition</b> <a href="#l00571">ComputeGraph.cuh:571</a></div></div>
<div class="ttc" id="aclassnz_1_1graph_1_1_compute_graph_html_a328a263c572540a330ba650651fb7722"><div class="ttname"><a href="classnz_1_1graph_1_1_compute_graph.html#a328a263c572540a330ba650651fb7722">nz::graph::ComputeGraph::ComputeGraph</a></div><div class="ttdeci">ComputeGraph()=default</div><div class="ttdoc">Default constructor for the ComputeGraph class.</div></div>
<div class="ttc" id="aclassnz_1_1graph_1_1_compute_graph_html_a5ce9a271dcea6cc2b9490cd815ee53ed"><div class="ttname"><a href="classnz_1_1graph_1_1_compute_graph.html#a5ce9a271dcea6cc2b9490cd815ee53ed">nz::graph::ComputeGraph::addNode</a></div><div class="ttdeci">NodeType * addNode(NodeType *node, const std::string &amp;name=&quot;default&quot;)</div><div class="ttdoc">Adds a node of any type to the computational graph.</div><div class="ttdef"><b>Definition</b> <a href="#l00511">ComputeGraph.cuh:511</a></div></div>
<div class="ttc" id="aclassnz_1_1graph_1_1_compute_graph_html_a6397db45a249af6389dd3f7548b5aa0a"><div class="ttname"><a href="classnz_1_1graph_1_1_compute_graph.html#a6397db45a249af6389dd3f7548b5aa0a">nz::graph::ComputeGraph::~ComputeGraph</a></div><div class="ttdeci">~ComputeGraph()=default</div><div class="ttdoc">Destructor for the ComputeGraph class.</div></div>
<div class="ttc" id="aclassnz_1_1nodes_1_1_node_html"><div class="ttname"><a href="classnz_1_1nodes_1_1_node.html">nz::nodes::Node</a></div><div class="ttdoc">Base class for nodes in a neural network or computational graph.</div><div class="ttdef"><b>Definition</b> <a href="_nodes_8cuh_source.html#l00114">Nodes.cuh:114</a></div></div>
<div class="ttc" id="aclassnz_1_1nodes_1_1calc_1_1_add_node_html"><div class="ttname"><a href="classnz_1_1nodes_1_1calc_1_1_add_node.html">nz::nodes::calc::AddNode</a></div><div class="ttdoc">Represents a node that performs element-wise addition between two input tensors.</div><div class="ttdef"><b>Definition</b> <a href="_nodes_8cuh_source.html#l00917">Nodes.cuh:917</a></div></div>
<div class="ttc" id="aclassnz_1_1nodes_1_1calc_1_1_e_l_u_node_html"><div class="ttname"><a href="classnz_1_1nodes_1_1calc_1_1_e_l_u_node.html">nz::nodes::calc::ELUNode</a></div><div class="ttdoc">Represents an Exponential Linear Unit (ELU) activation function node in a computational graph.</div><div class="ttdef"><b>Definition</b> <a href="_nodes_8cuh_source.html#l02648">Nodes.cuh:2648</a></div></div>
<div class="ttc" id="aclassnz_1_1nodes_1_1calc_1_1_hard_sigmoid_node_html"><div class="ttname"><a href="classnz_1_1nodes_1_1calc_1_1_hard_sigmoid_node.html">nz::nodes::calc::HardSigmoidNode</a></div><div class="ttdoc">Represents a Hard Sigmoid activation function node in a computational graph.</div><div class="ttdef"><b>Definition</b> <a href="_nodes_8cuh_source.html#l02803">Nodes.cuh:2803</a></div></div>
<div class="ttc" id="aclassnz_1_1nodes_1_1calc_1_1_hard_swish_node_html"><div class="ttname"><a href="classnz_1_1nodes_1_1calc_1_1_hard_swish_node.html">nz::nodes::calc::HardSwishNode</a></div><div class="ttdoc">Represents a Hard Swish activation function node in a computational graph.</div><div class="ttdef"><b>Definition</b> <a href="_nodes_8cuh_source.html#l02954">Nodes.cuh:2954</a></div></div>
<div class="ttc" id="aclassnz_1_1nodes_1_1calc_1_1_leaky_re_l_u_node_html"><div class="ttname"><a href="classnz_1_1nodes_1_1calc_1_1_leaky_re_l_u_node.html">nz::nodes::calc::LeakyReLUNode</a></div><div class="ttdoc">Represents a Leaky Rectified Linear Unit (LeakyReLU) activation function node in a computational grap...</div><div class="ttdef"><b>Definition</b> <a href="_nodes_8cuh_source.html#l02353">Nodes.cuh:2353</a></div></div>
<div class="ttc" id="aclassnz_1_1nodes_1_1calc_1_1_mat_mul_node_html"><div class="ttname"><a href="classnz_1_1nodes_1_1calc_1_1_mat_mul_node.html">nz::nodes::calc::MatMulNode</a></div><div class="ttdoc">Represents a matrix multiplication operation node in a computational graph.</div><div class="ttdef"><b>Definition</b> <a href="_nodes_8cuh_source.html#l01060">Nodes.cuh:1060</a></div></div>
<div class="ttc" id="aclassnz_1_1nodes_1_1calc_1_1_re_l_u_node_html"><div class="ttname"><a href="classnz_1_1nodes_1_1calc_1_1_re_l_u_node.html">nz::nodes::calc::ReLUNode</a></div><div class="ttdoc">Represents a Rectified Linear Unit (ReLU) operation node in a computational graph.</div><div class="ttdef"><b>Definition</b> <a href="_nodes_8cuh_source.html#l01929">Nodes.cuh:1929</a></div></div>
<div class="ttc" id="aclassnz_1_1nodes_1_1calc_1_1_sigmoid_node_html"><div class="ttname"><a href="classnz_1_1nodes_1_1calc_1_1_sigmoid_node.html">nz::nodes::calc::SigmoidNode</a></div><div class="ttdoc">Represents a Sigmoid activation function node in a computational graph.</div><div class="ttdef"><b>Definition</b> <a href="_nodes_8cuh_source.html#l02072">Nodes.cuh:2072</a></div></div>
<div class="ttc" id="aclassnz_1_1nodes_1_1calc_1_1_softmax_node_html"><div class="ttname"><a href="classnz_1_1nodes_1_1calc_1_1_softmax_node.html">nz::nodes::calc::SoftmaxNode</a></div><div class="ttdoc">Implements the Softmax activation function as a node in a neural network computational graph.</div><div class="ttdef"><b>Definition</b> <a href="_nodes_8cuh_source.html#l03152">Nodes.cuh:3152</a></div></div>
<div class="ttc" id="aclassnz_1_1nodes_1_1calc_1_1_sub_node_html"><div class="ttname"><a href="classnz_1_1nodes_1_1calc_1_1_sub_node.html">nz::nodes::calc::SubNode</a></div><div class="ttdoc">Represents a subtraction operation node in a computational graph.</div><div class="ttdef"><b>Definition</b> <a href="_nodes_8cuh_source.html#l01787">Nodes.cuh:1787</a></div></div>
<div class="ttc" id="aclassnz_1_1nodes_1_1calc_1_1_swish_node_html"><div class="ttname"><a href="classnz_1_1nodes_1_1calc_1_1_swish_node.html">nz::nodes::calc::SwishNode</a></div><div class="ttdoc">Represents a Swish activation function node in a computational graph.</div><div class="ttdef"><b>Definition</b> <a href="_nodes_8cuh_source.html#l02504">Nodes.cuh:2504</a></div></div>
<div class="ttc" id="aclassnz_1_1nodes_1_1calc_1_1_tanh_node_html"><div class="ttname"><a href="classnz_1_1nodes_1_1calc_1_1_tanh_node.html">nz::nodes::calc::TanhNode</a></div><div class="ttdoc">Represents a hyperbolic tangent (tanh) activation function node in a computational graph.</div><div class="ttdef"><b>Definition</b> <a href="_nodes_8cuh_source.html#l02214">Nodes.cuh:2214</a></div></div>
<div class="ttc" id="aclassnz_1_1nodes_1_1io_1_1_input_node_html"><div class="ttname"><a href="classnz_1_1nodes_1_1io_1_1_input_node.html">nz::nodes::io::InputNode</a></div><div class="ttdoc">Represents an input node in a computational graph.</div><div class="ttdef"><b>Definition</b> <a href="_nodes_8cuh_source.html#l00437">Nodes.cuh:437</a></div></div>
<div class="ttc" id="aclassnz_1_1nodes_1_1io_1_1_output_node_html"><div class="ttname"><a href="classnz_1_1nodes_1_1io_1_1_output_node.html">nz::nodes::io::OutputNode</a></div><div class="ttdoc">Base class for loss function nodes in a computational graph.</div><div class="ttdef"><b>Definition</b> <a href="_nodes_8cuh_source.html#l00683">Nodes.cuh:683</a></div></div>
<div class="ttc" id="aclassnz_1_1nodes_1_1loss_1_1_binary_cross_entropy_node_html"><div class="ttname"><a href="classnz_1_1nodes_1_1loss_1_1_binary_cross_entropy_node.html">nz::nodes::loss::BinaryCrossEntropyNode</a></div><div class="ttdoc">Represents the Binary Cross-Entropy (BCE) loss function node in a computational graph.</div><div class="ttdef"><b>Definition</b> <a href="_nodes_8cuh_source.html#l04958">Nodes.cuh:4958</a></div></div>
<div class="ttc" id="aclassnz_1_1nodes_1_1loss_1_1_mean_squared_error_node_html"><div class="ttname"><a href="classnz_1_1nodes_1_1loss_1_1_mean_squared_error_node.html">nz::nodes::loss::MeanSquaredErrorNode</a></div><div class="ttdoc">Represents the Mean Squared Error (MSE) loss function node in a computational graph.</div><div class="ttdef"><b>Definition</b> <a href="_nodes_8cuh_source.html#l04804">Nodes.cuh:4804</a></div></div>
<div class="ttc" id="aclassnz_1_1opt_1_1_optimizer_html"><div class="ttname"><a href="classnz_1_1opt_1_1_optimizer.html">nz::opt::Optimizer</a></div><div class="ttdoc">Base class for optimization algorithms in deep learning.</div><div class="ttdef"><b>Definition</b> <a href="_optimizer_8cuh_source.html#l00125">Optimizer.cuh:125</a></div></div>
<div class="ttc" id="anamespacenz_1_1graph_html"><div class="ttname"><a href="namespacenz_1_1graph.html">nz::graph</a></div><div class="ttdoc">Contains classes and functions for managing and executing computation graphs in deep learning workflo...</div></div>
<div class="ttc" id="anamespacenz_1_1graph_html_a3c6187d695022b05df227d913ac89d91"><div class="ttname"><a href="namespacenz_1_1graph.html#a3c6187d695022b05df227d913ac89d91">nz::graph::CreateNode</a></div><div class="ttdeci">void CreateNode(ComputeGraph *graph, const std::string &amp;type, const std::string &amp;name, std::vector&lt; int &gt; pre, const Tensor::shape_type &amp;shape, float *data, const bool requires_grad, float *grad)</div><div class="ttdoc">Creates and adds a node to the computational graph based on the specified type.</div><div class="ttdef"><b>Definition</b> <a href="_compute_graph_8cu_source.html#l00108">ComputeGraph.cu:108</a></div></div>
<div class="ttc" id="anamespacenz_1_1nodes_html_a42672c2d7708ae1d0c071fd9bef6c03c"><div class="ttname"><a href="namespacenz_1_1nodes.html#a42672c2d7708ae1d0c071fd9bef6c03c">nz::nodes::operator&lt;&lt;</a></div><div class="ttdeci">std::enable_if_t&lt; std::is_base_of_v&lt; Node, T &gt;, std::ostream &amp; &gt; operator&lt;&lt;(std::ostream &amp;os, const T &amp;node)</div><div class="ttdoc">Overloads the &lt;&lt; operator to print information about a node.</div><div class="ttdef"><b>Definition</b> <a href="_nodes_8cuh_source.html#l00114">Nodes.cuh:352</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.12.0
</small></address>
</div><!-- doc-content -->
</body>
</html>
